package com.whfc.fuum.dao;

import com.whfc.fuum.entity.OpenApiLicenseRule;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface OpenApiLicenseRuleMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(OpenApiLicenseRule record);

    int insertSelective(OpenApiLicenseRule record);

    OpenApiLicenseRule selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(OpenApiLicenseRule record);

    int updateByPrimaryKey(OpenApiLicenseRule record);

    /**
     * 批量插入
     *
     * @param appKey
     * @param ruleIdList
     * @return
     */
    int batchInsert(@Param("deptId") Integer deptId,
                    @Param("appKey") String appKey,
                    @Param("ruleIdList") List<Integer> ruleIdList);

    /**
     * 批量删除
     *
     * @param appKey
     * @return
     */
    int deleteByAppKey(@Param("appKey") String appKey);

    /**
     * 批量删除
     *
     * @param deptId
     * @return
     */
    int deleteByDeptId(@Param("deptId") Integer deptId);

    /**
     * 根据appKey查询权限ID列表
     *
     * @param appKey
     * @return
     */
    List<Integer> selectRuleIdListByAppKey(@Param("appKey") String appKey);


    /**
     * 根据组织机构查找权限ID列表
     *
     * @param deptId 组织机构ID
     * @return 权限ID列表
     */
    List<Integer> selectRuleIdListByDeptId(@Param("deptId") Integer deptId);
}